def apply_boundary_conditions(K, F, boundary_conditions):
    """
    边界条件函数，消除约束自由度
    """
    for bc in boundary_conditions:
        dof = bc['dof']
        value = bc['value']
        K[dof, :] = 0
        K[:, dof] = 0
        K[dof, dof] = 1
        F[dof] = value